package com.beverages.messages.client;

import com.beverages.messages.common.Result;
import com.beverages.messages.config.FeignOkHttpConfig;
import com.beverages.messages.entity.dto.intermediate.OrdersDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(name = "merchant-orders-service", url = "${merchant.orders.service.url}", configuration = FeignOkHttpConfig.class)
public interface MerchantOrdersClient {

    @GetMapping("/merchant/orders/update-completion-status")
    Result updateCompletionStatus(
            @RequestParam(name = "orderId") Integer orderId,
            @RequestParam(name = "completionStatus") Integer completionStatus);

    @GetMapping("/merchant/orders/{orderId}")
    Result<OrdersDTO> findOne(@PathVariable("orderId") Integer orderId);

    @GetMapping("/merchant/orders/orderNumber/{orderNumber}")
    Result<OrdersDTO> findOneByOrderNumber(@PathVariable("orderNumber") String orderNumber);

    @GetMapping("/merchant/orders/cancel-order")
    Result cancelOrder(@RequestParam(name = "orderNumber") String orderNumber);
}